<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<head>
	<base href="<%=basePath%>">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<link rel="stylesheet" type="text/css" href="css/css.css"/>
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script src="js/jquery-3.6.0.js"></script>
	<script>
        function admin_register(e) {
            var formObject = {};
            var formArray = $("#form1").serializeArray();
            $.each(formArray, function (i, item) {
                formObject[item.name] = item.value;
            });
            $.ajax({
                url: 'soldier_info/register',
                headers: {
                    'Content-Type': 'application/json;charset=utf-8',
                },
                type: 'POST',
                data: JSON.stringify(formObject),
                dataType: "json",
                success: function (data) {
                    if (data.code == '1011') {
                        alert("注册成功，请登录");
                        window.location.href = "jsp/Soldier_login.jsp";
                    } else if (data.code = '1012') {
                        alert("账号已存在，请重新输入");
                        window.location.reload();
                    } else if (data.code = '1013') {
                        alert("两次输入的密码不同，请重新输入");
                        window.location.reload();
                    } else if (data.code = '1010') {
                        alert("注册失败，请重试");
                        window.location.reload();
                    }
                }
            })
        }
	</script>
	<style>
	.bulletin{
        top: 140px;
        right: 90px;
        position: absolute;
        width: 400px;
        height: 480px;
	}
	.bu1{
		top:70px;
		right:360px;
		position:absolute;
		width:130px;
		height:50px;
	}
	.sp1{
        height: 50px;
        line-height: 50px;
        margin-top: 10px;
        font-size: 18px;
        color: #438eb9;
	}

	</style>
</head>
<body>
<div id="pageAll">
	<div class="pageTop">
		<div class="page">
			<img src="img/coin02.png"/>退役军人注册
		</div>
	</div>
	<div class="page ">
		<!-- 会员注册页面样式 -->
		<div class="banneradd bor">
			<div class="baTopNo">
				<span>退役军人注册</span>
			</div>
			<form id="form1">
				<div class="baBody">
					<div class="bbD">
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;姓名：<input
							type="text" class="input3" name="soldierName" placeholder="输入姓名"/>
					</div>
					<div class="bbD">
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;手机号：<input type="text" class="input3" name="mobile" placeholder="输入手机号"/>
					</div>
					<div class="bbD">
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;账号密码：<input type="password" class="input3" name="password" placeholder="输入密码"/>
					</div>
					<div class="bbD">
						再次输入密码：<input type="password" class="input3" name="password1" placeholder="再次输入密码"/>
					</div>
					<div class="bbD">
						<p class="bbDP">
							<span class="btn_ok btn_yes" onclick="admin_register()"><input type="hidden"/>提交</span>
							<a class="btn_ok btn_no" href="jsp/Soldier_login.jsp">取消</a>
						</p>
					</div>
				</div>
			</form>
			<div class="bu1">
				<span class="sp1">公告：</span>
			</div>
			<div class="bulletin">
				<c:forEach items="${bulletinList}" var="b">
					<a href="jsp/see_bulletinList.jsp?title=${b.title}&content=${b.content}"><tr>${b.title}</tr><br></a>
				</c:forEach>
			</div>
		</div>

		<!-- 会员注册页面样式end -->
	</div>
</div>
</body>
</html>